$(function(){
    var delParent;
    var defaults = {
        fileType: ["jpg","png","bmp","jpeg"],   // 上传文件的类型
        fileSize: 1024 * 1024 * 3 // 上传文件的大小 10M
    };
    /*点击图片的文本框*/
    $(".file").change(function(){
        var _this=this;
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 8 || totalNum > 8 ){
            alert("上传图片数目不可以超过8个，请重新选择");  //一次选择上传超过8个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 8){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                console.log(newimg.width,newimg.height);
                if(newimg.width!=368 || newimg.height!=368){
                   // alert("（建议上传图片大小368X368px）")
                    method.msg_layer({
                        title: "提示信息",
                        content:"（建议上传图片大小368X368px）",
                        btn: ["确定",""]
                    });
                }
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                // $input.appendTo($section);
                // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                // $input2.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 8){
            $(this).parent().hide();
        }
    });
    /*商品详情多张图片上传*/
   /* $(".filemore").each(function (index,item) {
        $(document).on("change",item,function(){
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function () {
                        console.log(newimg)
                        console.log(newimg.width,newimg.height);
                        if(newimg.width!=368 || newimg.height!=368){
                            /!*alert("（建议上传图片大小368X368px）")*!/
                            iosOverlay({
                                text: "建议上传尺寸368*368px!",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                    var $p = $("<p class='img-name-p'>");
                    $p.html(fileList[i].name).appendTo($section);
                    // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                    // $input.appendTo($section);
                    // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                    // $input2.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }

        })
    })*/
    /*
     $(".file01").change(function(){
     if(!$(".more")[0].checked){
     return false
     }else{
     var idFile = $(this).attr("id");
     var file = document.getElementById(idFile);
     var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
     var fileList = file.files; //获取的图片文件
     var input = $(this).parent();//文本框的父亲元素
     var imgArr = [];
     //遍历得到的图片文件
     var numUp = imgContainer.find(".up-section").length;
     var totalNum = numUp + fileList.length;  //总的数量
     if(fileList.length > 1 || totalNum > 1 ){
     alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
     }
     else if(numUp < 1){
     fileList = validateUp(fileList);
     for(var i = 0;i<fileList.length;i++){
     var imgUrl = window.URL.createObjectURL(fileList[i]);
     var imgUrl = window.URL.createObjectURL(fileList[i]);
     var newimg=new Image();
     $(newimg).attr("src",imgUrl);
     newimg.onload=function () {
     console.log(newimg)
     console.log(newimg.width,newimg.height);
     if(newimg.width!=368 || newimg.height!=368){
     /!*alert("（建议上传图片大小368X368px）")*!/
     iosOverlay({
     text: "建议上传尺寸368*368px!",
     duration: 2e3,
     icon: "../../images/cross.png"
     });
     }
     };
     imgArr.push(imgUrl);
     var $section = $("<section class='up-section fl loading'>");
     imgContainer.prepend($section);
     var $span = $("<span class='up-span'>");
     $span.appendTo($section);

     var $img0 = $("<img class='close-upimg'>").on("click",function(event){
     event.preventDefault();
     event.stopPropagation();
     $(".works-mask").show();
     delParent = $(this).parent();
     });
     $img0.attr("src","/images/delete_tu.png").appendTo($section);
     var $img = $("<img class='up-img up-opcity'>");
     $img.attr("src",imgArr[i]);
     $img.appendTo($section);
     var $p = $("<p class='img-name-p'>");
     $p.html(fileList[i].name).appendTo($section);
     // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
     // $input.appendTo($section);
     // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
     // $input2.appendTo($section);

     }
     }
     setTimeout(function(){
     $(".up-section").removeClass("loading");
     $(".up-img").removeClass("up-opcity");
     },450);
     numUp = imgContainer.find(".up-section").length;
     if(numUp >= 1){
     $(this).parent().hide();
     }
     }
     });*/
    /*商品橱窗图片上传*/
    $(".filecc").change(function(){
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function () {
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width!=368 || newimg.height!=368){
                        /*alert("（建议上传图片大小368X368px）")*/
                        //iosOverlay({
                        //    text: "建议上传尺寸368*368px!",
                        //    duration: 2e3,
                        //    icon: "../../images/cross.png"
                        //});
                        method.msg_layer({
                            title: "提示信息",
                            content:"建议上传尺寸368*368px!",
                            btn: ["确定",""]
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);

                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                // $input.appendTo($section);
                // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                // $input2.appendTo($section);

            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    /*商品详情介绍单张图片上传*/
    $(document).on("change","#single",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                /*    var newimg=new Image();
                 $(newimg).attr("src",imgUrl);
                 newimg.onload=function () {
                 console.log(newimg)
                 console.log(newimg.width,newimg.height);
                 if(newimg.width!=750 || newimg.height!=450){
                 // alert("（建议上传图片大小750X450px）")
                 iosOverlay({
                 text: "建议上传尺寸750*450px!",
                 duration: 2e3,
                 icon: "../../images/cross.png"
                 });
                 }
                 };*/
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                // $input.appendTo($section);
                // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                // $input2.appendTo($section);

            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    /*  $("#single").change(function(){
     console.log($(".single")[0].checked);
     if(!$(".single")[0].checked){
     // $("#moreWrapper > input[type=file]")[0].disabled=true;
     return false
     }else{
     var idFile = $(this).attr("id");
     var file = document.getElementById(idFile);
     var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
     var fileList = file.files; //获取的图片文件
     var input = $(this).parent();//文本框的父亲元素
     var imgArr = [];
     //遍历得到的图片文件
     var numUp = imgContainer.find(".up-section").length;
     var totalNum = numUp + fileList.length;  //总的数量
     if(fileList.length > 1 || totalNum > 1 ){
     alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
     }
     else if(numUp < 1){
     fileList = validateUp(fileList);
     for(var i = 0;i<fileList.length;i++){
     var imgUrl = window.URL.createObjectURL(fileList[i]);
     /!*    var newimg=new Image();
     $(newimg).attr("src",imgUrl);
     newimg.onload=function () {
     console.log(newimg)
     console.log(newimg.width,newimg.height);
     if(newimg.width!=750 || newimg.height!=450){
     // alert("（建议上传图片大小750X450px）")
     iosOverlay({
     text: "建议上传尺寸750*450px!",
     duration: 2e3,
     icon: "../../images/cross.png"
     });
     }
     };*!/
     imgArr.push(imgUrl);
     var $section = $("<section class='up-section fl loading'>");
     imgContainer.prepend($section);
     var $span = $("<span class='up-span'>");
     $span.appendTo($section);
     var $img0 = $("<img class='close-upimg'>").on("click",function(event){
     event.preventDefault();
     event.stopPropagation();
     $(".works-mask").show();
     delParent = $(this).parent();
     });
     $img0.attr("src","/images/delete_tu.png").appendTo($section);
     var $img = $("<img class='up-img up-opcity'>");
     $img.attr("src",imgArr[i]);
     $img.appendTo($section);
     var $p = $("<p class='img-name-p'>");
     $p.html(fileList[i].name).appendTo($section);
     // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
     // $input.appendTo($section);
     // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
     // $input2.appendTo($section);
     }
     }
     setTimeout(function(){
     $(".up-section").removeClass("loading");
     $(".up-img").removeClass("up-opcity");
     },450);
     numUp = imgContainer.find(".up-section").length;
     if(numUp >= 1){
     $(this).parent().hide();
     }
     }
     });
     */
    /*banner图片上传按钮*/
    $("#banner1").change(function(){
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function () {
                    console.log(newimg)
                    console.log(newimg.width,newimg.height);
                    if(newimg.width!=368 || newimg.height!=368){
                        /*alert("（建议上传图片大小368X368px）")*/
                        iosOverlay({
                            text: "建议上传尺寸750*750px!",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                        /*
                        method.msg_layer({
                            title: "提示信息",
                            content:"建议上传尺寸750*750px!",
                            btn: ["确定",""]
                        });*/
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                // $input.appendTo($section);
                // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                // $input2.appendTo($section);

            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $("#banner2").change(function(){
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function () {
                    console.log(newimg)
                    console.log(newimg.width,newimg.height);
                    if(newimg.width!=368 || newimg.height!=368){
                        /*alert("（建议上传图片大小368X368px）")*/
                        iosOverlay({
                            text: "建议上传尺寸750*750px!",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);

                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                // $input.appendTo($section);
                // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                // $input2.appendTo($section);

            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $("#banner3").change(function(){
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function () {
                    console.log(newimg)
                    console.log(newimg.width,newimg.height);
                    if(newimg.width!=368 || newimg.height!=368){
                        /*alert("（建议上传图片大小368X368px）")*/
                        iosOverlay({
                            text: "建议上传尺寸750*750px!",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);

                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                // $input.appendTo($section);
                // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                // $input2.appendTo($section);

            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi01",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi02",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi03",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi04",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi05",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi06",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi07",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi08",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi09",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi010",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi011",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi012",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi013",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi014",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi015",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi016",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi017",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi018",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi019",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    $(document).on("change","#shi020",function () {
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 1 || totalNum > 1 ){
            alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 1){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function (){
                    console.log(newimg);
                    console.log(newimg.width,newimg.height);
                    if(newimg.width>800 ){
                        iosOverlay({
                            text: "图片太宽了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }else if(newimg.width<700){
                        iosOverlay({
                            text: "图片太窄了",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };
                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);
                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 1){
            $(this).parent().hide();
        }
    });
    /*传三张图*/
    $(".file3").change(function(){
        var idFile = $(this).attr("id");
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
        var fileList = file.files; //获取的图片文件
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];
        //遍历得到的图片文件
        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if(fileList.length > 3 || totalNum > 3 ){
            alert("上传图片数目不可以超过3个，请重新选择");  //一次选择上传超过3个 或者是已经上传和这次上传的到的总数也不可以超过5个
        }
        else if(numUp < 3){
            fileList = validateUp(fileList);
            for(var i = 0;i<fileList.length;i++){
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                var newimg=new Image();
                $(newimg).attr("src",imgUrl);
                newimg.onload=function () {
                    console.log(newimg)
                    console.log(newimg.width,newimg.height);
                    if(newimg.width!=750 || newimg.height!=750){
                        iosOverlay({
                            text: "建议上传尺寸750*750px!",
                            duration: 2e3,
                            icon: "../../images/cross.png"
                        });
                    }
                };

                imgArr.push(imgUrl);
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);

                var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();
                });
                $img0.attr("src","/images/delete_tu.png").appendTo($section);
                var $img = $("<img class='up-img up-opcity'>");
                $img.attr("src",imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                // $input.appendTo($section);
                // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                // $input2.appendTo($section);

            }
        }
        setTimeout(function(){
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        },450);
        numUp = imgContainer.find(".up-section").length;
        if(numUp >= 3){
            $(this).parent().hide();
        }
    });
    $(".z_photo").delegate(".close-upimg","click",function(){
        $(".works-mask").show();
        delParent = $(this).parent();
    });
    $(".wsdel-ok").click(function(){
        $(".works-mask").hide();
        var numUp = delParent.siblings().length;
        if(numUp < 9){
            delParent.parent().find(".z_file").show();
        }
        delParent.remove();
    });
    $(".wsdel-no").click(function(){
        $(".works-mask").hide();
    });
    function validateUp(files){
        var arrFiles = [];//替换的文件数组
        for(var i = 0, file; file = files[i]; i++){
            //获取文件上传的后缀名
            var newStr = file.name.split("").reverse().join("");
            if(newStr.split(".")[0] != null){
                var type = newStr.split(".")[0].split("").reverse().join("");
                // console.log(type+"===type===");
                if(jQuery.inArray(type, defaults.fileType) > -1){
                    // 类型符合，可以上传
                    // console.log(file)
                    if (file.size >= defaults.fileSize) {
                       // alert('您这个"'+ file.name +'"文件大小过大');
                        method.msg_layer({
                            title: "提示信息",
                            content:'您这个"'+ file.name +'"文件大小过大',
                            btn: ["确定",""]
                        });
                    }
                    else {
                        // 在这里需要判断当前所有文件中
                        arrFiles.push(file);
                    }
                }else{
                  //  alert('您这个"'+ file.name +'"上传类型不符合');
                    method.msg_layer({
                        title: "提示信息",
                        content:'您这个"'+ file.name +'"上传类型不符合',
                        btn: ["确定",""]
                    });
                }
            }else{
              //  alert('您这个"'+ file.name +'"没有类型, 无法识别');
                method.msg_layer({
                    title: "提示信息",
                    content:'您这个"'+ file.name +'"没有类型, 无法识别',
                    btn: ["确定",""]
                });
            }
        }
        return arrFiles;
    }
});

